import {getToken} from "@/util/TokenUtil";

let url = "ws://localhost:9010/ws"
let token = getToken()

let createWs = () => {
    let webSocket = new WebSocket(url, [token])

    webSocket.onopen = () => {
        console.log("open")
    }


    webSocket.onmessage = (message) => {
        console.log(message)
    }
    webSocket.onerror = (error) => {
        console.log(error)
    }
    webSocket.onclose = () => {
        console.log("close")
    }
    return webSocket
}
export default createWs